<?php
namespace app\store\controller\wechat;
use app\store\controller\Controller;
use app\store\model\Setting as SettingModel;

/**
 * 公众号模板消息
 */
class Tmsg extends Controller
{
   /**
    * 更新设置事件
    */
   public function setting()
   {
	   if (!$this->request->isAjax()) {
		   $values = SettingModel::getItem('tmsg');
		   return $this->fetch('setting', compact('values'));
	   }
	   if($err = is_power()){
		   return $this->renderError($err);
	   }
       $model = new SettingModel;
       if ($model->edit('tmsg',$this->postData('setting'))) {
           return $this->renderSuccess('更新成功');
       }
       return $this->renderError('更新失败');
   }
}
